var _menus = {
			"menus" : [ {
				"menuid" : "1",
				"icon" : "icon-sys",
				"menuname" : "我的工作区",
				"menus" : [ {
					"menuid" : "12",
					"menuname" : "工作单",
					"icon" : "icon-add",
					"url" : "",
					"child" : [ {
						"menuid" : "140",//此id如果变化，则index.js中，自动弹出该菜单的地方也要改动
						"menuname" : "新建工单",
						"icon" : "icon-role",
						"url" : ctx+"/workBill/new"
					}, {
						"menuid" : "150",
						"menuname" : "查看工单",
						"icon" : "icon-set",
						"url" : ctx+"/workBill/select"
					} ]
				}, {
					"menuid" : "13",
					"menuname" : "维修单",
					"icon" : "icon-users",
					"url" : ctx+"/ri/selectRepare"
				}, {
					"menuid" : "14",
					"menuname" : "安装单",
					"icon" : "icon-role",
					"url" : ctx+"/ri/selectInstall"
				}, {
					"menuid" : "15",
					"menuname" : "任务",
					"icon" : "icon-set",
					"url" : "demo.html"
				}, {
					"menuid" : "16",
					"menuname" : "工作周报",
					"icon" : "icon-log",
					"url" : "demo1.html"
				},  {
					"menuid" : "17",
					"menuname" : "公告",
					"icon" : "icon-log",
					"url" : "demo1.html"
				}, {
					"menuid" : "18",
					"menuname" : "在线用户",
					"icon" : "icon-log",
					"url" : "demo1.html"
				}

				]
			}, {
				"menuid" : "8",
				"icon" : "icon-sys",
				"menuname" : "基础资料",
				"menus" : [ {
					"menuid" : "801",
					"menuname" : "区域维护",
					"icon" : "icon-nav",
					"url" : ctx+"/area"
				},{
					"menuid" : "802",
					"menuname" : "员工维护",
					"icon" : "icon-nav",
					"url" : ctx+"/emp"
				},{
					"menuid" : "803",
					"menuname" : "角色维护",
					"icon" : "icon-nav",
					"url" : ctx+"/role"
				}, {
					"menuid" : "804",
					"menuname" : "产品资料",
					"icon" : "icon-nav",
					"url" : "demo1.html"
				} , {
					"menuid" : "805",
					"menuname" : "产品类型",
					"icon" : "icon-nav",
					"url" : "demo1.html"
				} , {
					"menuid" : "806",
					"menuname" : "故障类型",
					"icon" : "icon-nav",
					"url" : "demo1.html"
				} , {
					"menuid" : "807",
					"menuname" : "工资标准",
					"icon" : "icon-nav",
					"url" : "demo1.html"
				} ]
			}, {
				"menuid" : "56",
				"icon" : "icon-sys",
				"menuname" : "报表统计",
				"menus" : [ {
					"menuid" : "31",
					"menuname" : "工作统计",
					"icon" : "icon-nav",
					"url" : "demo1.html"
				}]
			} ]
		};

		//设置登录窗口
		function openPwd() {
			$('#w').window({
				title : '修改密码',
				width : 300,
				modal : true,
				shadow : true,
				closed : true,
				height : 160,
				resizable : false
			});
		}
		//关闭登录窗口
		function closePwd() {
			$('#w').window('close');
		}

		//修改密码
		function serverLogin() {
			var $newpass = $('#txtNewPass');
			var $rePass = $('#txtRePass');

			if ($newpass.val() == '') {
				msgShow('系统提示', '请输入密码！', 'warning');
				return false;
			}
			if ($rePass.val() == '') {
				msgShow('系统提示', '请在一次输入密码！', 'warning');
				return false;
			}

			if ($newpass.val() != $rePass.val()) {
				msgShow('系统提示', '两次密码不一至！请重新输入', 'warning');
				return false;
			}

			$.post('/ajax/editpassword.ashx?newpass=' + $newpass.val(),
					function(msg) {
						msgShow('系统提示', '恭喜，密码修改成功！<br>您的新密码为：' + msg, 'info');
						$newpass.val('');
						$rePass.val('');
						close();
					})

		}

		$(function() {

			openPwd();

			$('#editpass').click(function() {
				$('#w').window('open');
			});

			$('#btnEp').click(function() {
				serverLogin();
			})

			$('#btnCancel').click(function() {
				closePwd();
			})

			$('#loginOut').click(function() {
				$.messager.confirm('系统提示', '您确定要退出本次登录吗?', function(r) {

					if (r) {
						location.href = ctx+'/logout';
					}
				});
			})
			
			if(toAddWorkBill == "true"){
				var obj = $('.navlist li a[ref=140]');
				var oldRel = obj.attr("rel")
				obj.attr("rel",oldRel+"?phone="+phone);
				$('.navlist li a[ref=140]').click();
				obj.attr("rel",oldRel);
			}
			
		});
var addTabInSon = function(title,iframeName){
	$('#tabs').tabs('add',{
		title:title,
		content:'<iframe name="'+iframeName+'" scrolling="auto" frameborder="0"  src="" style="width:100%;height:100%;"></iframe>',
		closable:true
	});
}